load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("//build:wabt_build.bzl", "WABT_CXXOPTS")

filegroup(
    name = "config_h_in",
    srcs = ["config.h.in"],
    visibility = ["//include/wabt:__pkg__"],
)

cc_library(
    name = "lexer_keywords",
    hdrs = ["prebuilt/lexer-keywords.cc"],
    cxxopts = WABT_CXXOPTS,
    strip_include_prefix = "/src",
    textual_hdrs = ["prebuilt/lexer-keywords.cc"],
)

cc_library(
    name = "wabt",
    srcs = glob(
        include = [
            "*.c",
            "*.cc",
        ],
        exclude = ["test-*.cc"],
    ),
    cxxopts = WABT_CXXOPTS,
    implementation_deps = [
        ":lexer_keywords",
        "//third_party/picosha2",
    ],
    visibility = ["//:__subpackages__"],
    deps = ["//include/wabt"],
)

cc_library(
    name = "wabt_interp",
    srcs = glob(["interp/*.cc"]),
    cxxopts = WABT_CXXOPTS,
    implementation_deps = [
        ":wabt",
        "//third_party/wasm-c-api",
    ],
    visibility = ["//:__subpackages__"],
)

cc_library(
    name = "wabt_prebuilt_wasm2c",
    srcs = glob(["prebuilt/wasm2c_*.cc"]),
    cxxopts = WABT_CXXOPTS,
    visibility = ["//:__subpackages__"],
)
